'use client'
/**
 * 这个是app 全局的错误 处理
 * 不同于 根目录下 的error.tsx 
 */

import { useEffect } from "react"
export default function GlobalError({ error, reset }: { error: Error & { digest?: string }, reset: () => void}) {
  useEffect(() => {
    // Log the error to an error reporting service
    console.error(error)
  }, [error])

  return (
    <div>
      <h2>Something went wrong!</h2>
      <button
        onClick={
          // Attempt to recover by trying to re-render the segment
          () => reset()
        }>
        Try again
        </button>
    </div>
  )
}